<%@page import="entity.*"%>
<%@page import="util.*"%>

<%@ taglib prefix="stripes"
	uri="http://stripes.sourceforge.net/stripes-dynattr.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<jsp:useBean id="DateUtil" scope="page" class="util.DateUtil" />

<stripes:layout-render name="/student/master-page.jsp">

	<stripes:layout-component name="head">
		<link
			href="${pageContext.request.contextPath}/assets/css/course-offerings.css"
			rel="stylesheet" type="text/css" />
	</stripes:layout-component>

	<stripes:layout-component name="content">

		<center>
			<stripes:messages />
			<stripes:errors />
		</center>

		<div class="container legend">
			<div class="row">
				<div class="col-md-12">
					<span class="label label-default">Legend:</span> <span
						class="label label-success">Successful</span> <span
						class="label label-danger">Unsuccessful</span> <span
						class="label label-primary">Pending</span> <span
						class="label label-warning">Bookmarked</span>
				</div>
			</div>
		</div>

		<div class="row">

			<div class="col-md-2">
				<%@include file="/student/layout/school-panel.jsp"%></div>
			<div class="col-md-3">
				<%@include file="/student/layout/course-panel.jsp"%>
			</div>

			<div class="col-md-7">
				<div class="panel panel-info">
					<%@include file="/student/layout/course-info.jsp"%>
					<%@include file="/student/layout/sections-info.jsp"%>
				</div>
			</div>

		</div>

	</stripes:layout-component>


	<stripes:layout-component name="end">
		<script
			src="${pageContext.request.contextPath}/assets/js/filter-course-section.js"
			type="text/javascript"></script>
		<script type="text/javascript">
			$(document)
					.ready(
							function() {

								$('.prerequisite').tooltip({
									placement : 'bottom'
								});

								var computeScrollHeightForList = function(list) {
									var height = 0;
									$(list)
											.find('.active')
											.prevAll()
											.each(
													function() {
														height += $(this)
																.outerHeight() - 1; //extra 1 is to circumvent -1px margin
														console.log(height);
													});
									return height;
								}

								// scroll active list item to top
								var $listCourse = $("#list-course");
								$listCourse
										.scrollTop(computeScrollHeightForList($listCourse));

								var $listSchool = $("#list-school");
								var $selectedSchoolItem = $listSchool
										.find('.active');
								$listSchool.scrollTop($selectedSchoolItem
										.prevAll().length
										* $selectedSchoolItem.outerHeight());

							});
		</script>
	</stripes:layout-component>
</stripes:layout-render>